<template>
  <el-dialog
      title="模板删除"
      :visible.sync="visible"
      :with-header="false"
      custom-class="layer_wrap router_delete"
      :before-close="()=>handleClose()"
  >
    <div class="layer_inside">
      <div class="layer_header">
        <span class="title">模板删除</span>
        <i class="el-icon-close" @click="()=>handleClose()"/>
      </div>
      <div class="layer_main_wrap">
        <div class="layer_delete_main">
          确认删除该模板吗?删除的模板不可恢复！
        </div>
        <div class="layer_delete_bottom">
          <el-button class="button_item cancel" @click="()=>handleClose()">取消</el-button>
          <el-button class="button_item sure" type="primary" @click="()=>handleSure()">确认</el-button>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: ["visible", 'info'],
  name: "TemplateDelete",
  data() {
    return {};
  },

  computed: {},

  mounted() {},

  methods: {
    // 关闭
    handleClose() {
      this.$emit("handleCancel", false);
    },

    // 确认
    handleSure() {
      let params = Object();
      let info = (this.info);
      Reflect.set(params, 'ids', (info.id));
      this.$store.dispatch('template/setTemplateDelete', params).then((resp) => {
        if (!!resp && !!(resp.status)) {
          this.$emit("handleCancel", false);
          this.$emit("handleSure", true);
        }
      });
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/components/assets/style/layer";
@import "./assets/style";
</style>